$.fn.hoverdir = function(){
	$(this).on("mouseenter mouseleave", function(e){
		var dir = $.Hover.getDir({x:e.clientX, y:e.clientY}, this);
		$.Hover.move(dir, e.type, $(this).find("div"));
//		console.log(e.type)
	})
}

$.Hover = {
	getDir : function(coord, obj){
		var x = (coord.x - obj.offsetLeft - (obj.offsetWidth / 2)) * (obj.offsetWidth > obj.offsetHeight ? (obj.offsetHeight / obj.offsetWidth) : 1);
		var y = (coord.y - obj.offsetTop - (obj.offsetHeight / 2)) * (obj.offsetHeight > obj.offsetWidth ? (obj.offsetWidth / obj.offsetHeight) : 1); 
		var direction = Math.round((((Math.atan2(y, x) * (180 / Math.PI)) + 180) / 90) + 3) % 4; 
		return direction;
	},
	move : function(dir, eventtype, $obj){
		if(eventtype == "mouseenter") {
			switch(dir) {
				case 0 : $obj.css("left",0).css("top","-100%").animate({top:0},500); break;
				case 1 : $obj.css("left","100%").css("top",0).animate({left:0},500); break;
				case 2 :
				case 3 :
			}
		} else if(eventtype == "mouseleave") {
			switch(dir) {
				case 0 : 
				case 1 :
				case 2 :
				case 3 :
			}
		}
	}
}

/*$.Scroll = {
	
}

$.Move = {
	
}
*/
